﻿var ns = namespace("kaskelot.sp.ui");

ns.personuppdrag = function () {

	function getList() {
		var id = getParameterByName('PersonId');

		$.ajax({
			url: L_Menu_BaseUrl + "/_vti_bin/Kaskelot.SP.Resources/ClientPersonService.svc/GetUppdragByPerson",
			type: "GET",
			data: { id: id },
			processData: true,
			cache: false,
			success:
                function (data) {
                	if (!data.GetUppdragByPersonResult.HasError) {
                		$("#uppdrag-list tbody").html(
							$("#uppdrag-template").render(data.GetUppdragByPersonResult.Data)
						);
                	}
                },
			error:
                function (xhr) {
                	kaskelot.sp.ui.prompts.showErrorPrompt(xhr.responseText);
                }
		});
	}

	return {
		getList: getList
	};
}();